<template>
	<!-- :class="{ 'navbar-fixed': fixed }" -->
	<!-- :fixed="false" -->
	<view class="">
		<view class="bg" :class="fixed ? 'isfixed' : ''" :style="{ height: navbarHeight + 'rpx' }">
			<u-navbar :title="title" placeholder leftIconSize="24" bgColor="transparent" leftIconColor="#000000" titleStyle="color:#000000"
				:rightText="rightText" @rightClick="rightClick" @leftClick="leftClick"></u-navbar>
		</view>
		<view class="" style="width: 1rpx" :style="{ height: navbarHeight + 'rpx' }"></view>
	</view>
</template>
<script>
	export default {
		name: 'j-navbar',
		props: {
			title: {
				type: String,
				default () {
					return '我是navigate';
				}
			},
			// 是否悬浮,默认false
			fixed: {
				type: Boolean,
				default () {
					return true;
				}
			},
			navbarHeight: {
				type: Number,
				default () {
					return 177;
				}
			},
			rightText: {
				type: String,
				default () {
					return '';
				}
			}
		},
		data() {
			return {};
		},
		methods: {
			leftClick() {
				//获取所有页面
				// let currentPages = getCurrentPages();
				// let pageLen = currentPages.length;
				// console.log('------', pageLen);
				// if (pageLen == 1) {
				// 	uni.reLaunch({
				// 		url: '/pages/home/index'
				// 	});
				// }
				this.$emit('leftClick');
			},
			rightClick() {
				console.log('rightClick');
				this.$emit('rightClick');
			}
		}
	};
</script>
<style scoped lang="scss">
	@import '@/style/mixin.scss';

	.isfixed {
		position: fixed;
		left: 0;
		right: 0;
		top: 0;
		z-index: 99;
	}

	.bg {
		width: 100%;
		background-color: white;
		// @include bis('https://66chaowan.oss-cn-hangzhou.aliyuncs.com/app/images/navBar/navBar_bg1.png', 100% 100%);
	}

	::v-deep .u-navbar__content__title {
		font-size: 34rpx;
		font-family: PingFangSCR;
		font-weight: bold;
	}

	::v-deep .u-navbar__content__right {
		font-size: 34rpx;
		font-family: PingFangSCR;
		font-weight: bold;
		color: #fff;
	}
</style>